<?php
function cut_str($p_str,$p_start,$p_end){
	if ($p_start!=""){
		$v_start_post = strpos($p_str,$p_start);		
		if ($v_start_post===false) return "";
		$p_str = substr($p_str,$v_start_post+strlen($p_start));
		if ($p_end=="") return $p_str;
		$v_end_post = strpos($p_str,$p_end);	
		if ($v_end_post===false) return "";
		$p_str = substr($p_str,0,$v_end_post);
		return $p_str; 
	}else{
		if ($p_end!=""){
			$v_end_post = strpos($p_str,$p_end);	
			if ($v_end_post===false) return "";
			$p_str = substr($p_str,0,$v_end_post);
			return $p_str; 
		}else{
			return "";
		}
	}
}	

function stringBetween($strSource, $strStart, $strEnd)
{
	$arrRes = array();
	while ($strTemp = cut_str($strSource, $strStart, $strEnd))
	{
		array_push($arrRes, $strTemp);
		$posStart = strpos($strSource, $strStart);
		$strSource = substr($strSource,$posStart+strlen($strStart));
		$posEnd = strpos($strSource, $strEnd);
		$strSource = substr($strSource,$posEnd+strlen($strEnd));				
		$strSourceTemp = $strSource;
		$strTemp2 = cut_str($strSourceTemp, $strStart, $strEnd);
		if ($strTemp2 == "") return $arrRes;
	}
	return $arrRes;
}